
propsage.namespace("prestige.paymentVoucher");

prestige.paymentVoucher.payOut = (function($, ui){
	
	function initComponents() {
		if($('#PaymentVoucher_issued_date').val()){
			$('#issued_1').attr('checked', 'checked');
			$('.issued-date').show();
		} else {
			$('#issued_0').attr('checked', 'checked');
			$('.issued-date').hide();
		}
	}
	
	function initEventHandlers() 
	{ 
		$('#issued_0').on('click', onNotIssuedCheckBoxClicked);
		$('#issued_1').on('click', onIssuedCheckBoxClicked);
	}
	
	function onNotIssuedCheckBoxClicked()
	{
		$('.issued-date').hide();
		$('#PaymentVoucher_issued_date').val('');
	}
	
	function onIssuedCheckBoxClicked()
	{
		$('.issued-date').show();
	}
	
	$(document).ready(function(){
		initComponents();
		initEventHandlers();
	});
    
}(jQuery, propsage.ui));